home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Full / Paragon Drive Backup 9 / DB90_SE_x32.msi / Data1.cab / _0DB8143667A0473E8BC7034E8601E6FC < prev    next >
Text File  |  2004-02-07  |  11KB  |  527 lines

  1. //    WebHelp 5.10.004
  2. var gsFileName="";
  3. var gsDivName="";
  4. var xmlDoc=null;
  5. var sdocPath=null;
  6. var gsInsertBeforeEndHTML="";
  7. var sReplaceStringsSrc=new Array();
  8. var gsDivName="dataDiv";
  9. var gnLoadDivNum=0;
  10. sReplaceStringsSrc[0]="&";
  11. sReplaceStringsSrc[1]=">";
  12. sReplaceStringsSrc[2]="<";
  13. sReplaceStringsSrc[3]=""";
  14. sReplaceStringsSrc[4]=String.fromCharCode(8364);
  15. sReplaceStringsSrc[5]=" ";
  16.  
  17. var sReplaceStringsDst=new Array();
  18. sReplaceStringsDst[0]="&";
  19. sReplaceStringsDst[1]=">";
  20. sReplaceStringsDst[2]="<";
  21. sReplaceStringsDst[3]="\"";
  22. sReplaceStringsDst[4]=String.fromCharCode(128);
  23. sReplaceStringsDst[5]=" ";
  24. var goHighLighted=null;
  25.  
  26. function _getRelativePath(strParentPath,strCurrentPath)
  27. {
  28.     if(_isAbsPath(strCurrentPath)) return _getPath(strCurrentPath);
  29.     strParentPath=_replaceSlash(strParentPath);
  30.     strParentPath=_getPath(strParentPath);
  31.     strCurrentPath=_replaceSlash(strCurrentPath);
  32.     strCurrentPath=_getPath(strCurrentPath);
  33.     for(var i=0;i<strParentPath.length&&i<strCurrentPath.length;i++)
  34.     {
  35.         if(strParentPath.charAt(i)!=strCurrentPath.charAt(i))
  36.             break;
  37.     }
  38.     
  39.     strParentPath=strParentPath.substring(i);
  40.     strCurrentPath=strCurrentPath.substring(i);    
  41.     
  42.     var nPathPos=0;
  43.     while(nPathPos!=-1)
  44.     {
  45.         nPathPos=strParentPath.indexOf("/");
  46.         if(nPathPos!=-1)
  47.         {
  48.             strParentPath=strParentPath.substring(nPathPos+1);
  49.             strCurrentPath="../"+strCurrentPath;
  50.         }
  51.     }
  52.     return strCurrentPath;
  53. }
  54.  
  55. function _getRelativeFileName(strParentPath,strCurrentPath)
  56. {
  57.     strParentPath=_replaceSlash(strParentPath);
  58.     strParentPath=_getPath(strParentPath);
  59.     strCurrentPath=_replaceSlash(strCurrentPath);
  60.     for(var i=0;i<strParentPath.length&&i<strCurrentPath.length;i++)
  61.     {
  62.         if(strParentPath.charAt(i)!=strCurrentPath.charAt(i))
  63.             break;
  64.     }
  65.     
  66.     strParentPath=strParentPath.substring(i);
  67.     strCurrentPath=strCurrentPath.substring(i);    
  68.     
  69.     var nPathPos=0;
  70.     while(nPathPos!=-1)
  71.     {
  72.         nPathPos=strParentPath.indexOf("/");
  73.         if(nPathPos!=-1)
  74.         {
  75.             strParentPath=strParentPath.substring(nPathPos+1);
  76.             strCurrentPath="../"+strCurrentPath;
  77.         }
  78.     }
  79.     return strCurrentPath;
  80. }
  81.  
  82. function _isAbsPathToHost(sPath)
  83. {
  84.     return (sPath.indexOf("/")==0);
  85. }
  86.  
  87. function _getHost(sPath)
  88. {
  89.     var nPos=sPath.indexOf("//");
  90.     if(nPos>0)
  91.     {
  92.         var nPosx=sPath.indexOf("/",nPos+2);
  93.         if(nPosx>0)
  94.             return sPath.substring(0,nPosx);
  95.         else
  96.             return sPath;
  97.     }
  98.     return sPath;
  99. }
  100.  
  101. function _getFullPath(sPath,sRelPath)
  102. {
  103.     if(_isAbsPath(sRelPath))
  104.         return sRelPath;
  105.     else if(_isAbsPathToHost(sRelPath))
  106.         return _getHost(sPath)+sRelPath;
  107.     else
  108.     {
  109.         var sFullPath=sPath;
  110.         var nPathPos=0;
  111.         while(nPathPos!=-1)
  112.         {
  113.             var nPathPos=sRelPath.indexOf("../");
  114.             if(nPathPos!=-1)
  115.             {
  116.                 sRelPath=sRelPath.substring(nPathPos+3);
  117.                 sFullPath=sFullPath.substring(0,sFullPath.length-1);
  118.                 var nPos2=sFullPath.lastIndexOf("/");
  119.                 if(nPos2!=-1)
  120.                     sFullPath=sFullPath.substring(0,nPos2+1);
  121.                 else
  122.                     break;
  123.             }
  124.         }
  125.         sFullPath+=sRelPath;
  126.         return sFullPath;
  127.     }    
  128. }
  129.  
  130. function _isAbsPath(strPath)
  131. {
  132.     var strUpper=strPath.toUpperCase();
  133.     return (strUpper.indexOf(":")!=-1||strUpper.indexOf("\\\\")==0);
  134. }
  135.  
  136. function _replaceSlash(strURL)
  137. {    
  138.     var re=new RegExp("\\\\","g");
  139.     var strReplacedURL=strURL.replace(re,"/");
  140.     return strReplacedURL;
  141. }
  142.  
  143. function _getPath(strURL)
  144. {
  145.     pathpos=strURL.lastIndexOf("/");
  146.     if(pathpos>0)
  147.         return strURL.substring(0,pathpos+1);
  148.     else
  149.         return "";
  150. }
  151.  
  152. function removeItemFromArray(oArray,i)
  153. {
  154.     if(oArray.length&&i>=0&&i<oArray.length)
  155.     {
  156.         var len=oArray.length;
  157.         for(var s=i;s<len-1;s++)
  158.             oArray[s]=oArray[s+1];
  159.         oArray.length=len-1;
  160.     }
  161. }
  162.  
  163. function insertItemIntoArray(oArray,i,obj)
  164. {
  165.     if(oArray.length&&i>=0&&i<=oArray.length)
  166.     {
  167.         var len=oArray.length;
  168.         for(var s=len;s>i;s--)
  169.             oArray[s]=oArray[s-1];
  170.         oArray[i]=obj;        
  171.     }
  172. }
  173.  
  174. function loadData(sFileName)
  175. {
  176.     var i=gnLoadDivNum;
  177.     var sName=gsDivName+gnLoadDivNum++;
  178.     loadData_2(sFileName,sName);
  179. }
  180.  
  181. function loadData_2(sFileName,sDivName)
  182. {
  183.     if(!getElement(sDivName))
  184.     {
  185.         if(!insertDataDiv(sDivName))
  186.         {
  187.             gsFileName=sFileName;
  188.             gsDivName=sDivName;
  189.             return;
  190.         }
  191.     }
  192.     var sHTML="";
  193.     if(gbMac)
  194.         sHTML+="<iframe src=\""+sFileName+"\"></iframe>";
  195.     else
  196.         sHTML+="<iframe style=\"visibility:hidden;width:0;height:0\" src=\""+sFileName+"\"></iframe>";
  197.     
  198.     var oDivCon=getElement(sDivName);
  199.     if(oDivCon)
  200.     {
  201.         if(gbNav6)
  202.         {
  203.             if(oDivCon.getElementsByTagName&&oDivCon.getElementsByTagName("iFrame").length>0)
  204.             {
  205.                 oDivCon.getElementsByTagName("iFrame")[0].src=sFileName;
  206.             }
  207.             else
  208.                 oDivCon.innerHTML=sHTML;
  209.         }
  210.         else
  211.             oDivCon.innerHTML=sHTML;
  212.     }
  213. }
  214.  
  215. function loadDataXML(sFileName)
  216. {
  217.     var sCurrentDocPath=_getPath(document.location.href);
  218.     sdocPath=_getFullPath(sCurrentDocPath,sFileName);
  219.     if(gbIE5)
  220.     {
  221.         xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
  222.         xmlDoc.async=true;
  223.         xmlDoc.onreadystatechange=checkState;
  224.         if(document.body!=null)
  225.             xmlDoc.load(sdocPath);
  226.     }
  227.     else if(gbNav6)
  228.     {
  229.         xmlDoc=document.implementation.createDocument("","",null);
  230.         xmlDoc.addEventListener("load",initializeData,false);
  231.         xmlDoc.load(sdocPath,"text/xml");
  232.     }
  233. }
  234.  
  235. function initializeData()
  236. {
  237.     if(xmlDoc!=null)
  238.         putDataXML(xmlDoc,sdocPath);
  239. }
  240.  
  241. function checkState()
  242. {
  243.     if(xmlDoc!=null)
  244.     {
  245.         var state=xmlDoc.readyState;
  246.         if(state==4)
  247.         {
  248.             var err=xmlDoc.parseError;
  249.             if(err.errorCode==0)
  250.                 putDataXML(xmlDoc,sdocPath);
  251.             else
  252.                 onLoadXMLError();
  253.         }
  254.     }
  255. }
  256.  
  257. function insertDataDiv(sName)
  258. {
  259.     var sHTML="";
  260.     if(gbMac)
  261.         sHTML+="<div id="+sName+" style=\"display:none;\"></div>";
  262.     else
  263.         sHTML+="<div id="+sName+" style=\"visibility:hidden\"></div>";
  264.     if((gbIE5||gbNav6)&&document.body)
  265.         document.body.insertAdjacentHTML("beforeEnd",sHTML);
  266.     else
  267.     {
  268.         gsInsertBeforeEndHTML=sHTML;
  269.         setTimeout("insertWhenBodyReady();",100);
  270.         return false;
  271.     }
  272.     return true;
  273. }
  274.  
  275. function insertWhenBodyReady()
  276. {
  277.     if(gsInsertBeforeEndHTML=="") return;
  278.     if(document.body)
  279.     {
  280.         document.body.insertAdjacentHTML("beforeEnd",gsInsertBeforeEndHTML);
  281.         gsInsertBeforeEndHTML="";
  282.         loadData_2(gsFileName,gsDivName);
  283.     }
  284.     else
  285.     {
  286.         setTimeout("insertWhenBodyReady();",100);
  287.     }
  288. }
  289.  
  290. function window_BUnload()
  291. {
  292.     for(var i=0;i<gnLoadDivNum;i++)
  293.     {
  294.         var oDivCon=getElement(gsDivName+i);
  295.         if(oDivCon)
  296.             oDivCon.innerHTML="";
  297.     }
  298. }
  299.  
  300. function removeThis(obj)
  301. {
  302.     if(obj.parentNode)
  303.         obj.parentNode.removeChild(obj);
  304.     else
  305.         obj.outerHTML="";
  306. }
  307.  
  308. function getParentNode(obj)
  309. {
  310.     if(obj.parentNode)
  311.         return obj.parentNode;
  312.     else if(obj.parentElement)
  313.         return obj.parentElement;
  314.     return null;
  315. }
  316.  
  317. function getElement(sID)
  318. {
  319.     if(document.getElementById)
  320.         return document.getElementById(sID);
  321.     else if(document.all)
  322.         return document.all(sID);
  323.     return null;
  324. }
  325.  
  326. function getChildrenByTag(obj,sTagName)
  327. {
  328.     if(obj.getElementsByTagName)
  329.     {
  330.         var aChildren=new Array();
  331.         var aElements=getElementsByTag(obj,sTagName);
  332.         if(aElements!=null)
  333.         {
  334.             for(var i=0;i<aElements.length;i++)
  335.             {
  336.                 if(aElements[i].parentNode==obj)
  337.                     aChildren[aChildren.length]=aElements[i];
  338.             }
  339.             return aChildren;
  340.         }
  341.         else
  342.             return new Array();
  343.     }
  344.     else if(obj.children)
  345.         return obj.children.tags(sTagName);
  346. }
  347.  
  348. function getElementsByTag(obj,sTagName)
  349. {
  350.     if(obj.getElementsByTagName)
  351.         return obj.getElementsByTagName(sTagName);
  352.     else if(obj.all)
  353.         return obj.all.tags(sTagName);
  354.     return null;
  355. }
  356.  
  357. function _htmlToText(sHTML)
  358. {
  359.     if(sHTML==null) return null;
  360.     var sText=sHTML;
  361.     for(var i=0;i<sReplaceStringsSrc.length;i++)
  362.     {
  363.         var re=new RegExp(sReplaceStringsSrc[i],"g");
  364.         sText=sText.replace(re,sReplaceStringsDst[i]);
  365.     }    
  366.     return sText;
  367. }
  368.  
  369. function _textToHtml_nonbsp(sText)
  370. {
  371.     if(sText==null) return null;
  372.     var sHTML=sText;
  373.     for(var i=0;i<sReplaceStringsSrc.length-1;i++)
  374.     {
  375.         var re=new RegExp(sReplaceStringsDst[i],"g");
  376.         sHTML=sHTML.replace(re,sReplaceStringsSrc[i]);
  377.     }    
  378.     return sHTML;
  379. }
  380.  
  381. function _textToHtml(sText)
  382. {
  383.     if(sText==null) return null;
  384.     var sHTML=sText;
  385.     for(var i=0;i<sReplaceStringsSrc.length;i++)
  386.     {
  387.         var re=new RegExp(sReplaceStringsDst[i],"g");
  388.         sHTML=sHTML.replace(re,sReplaceStringsSrc[i]);
  389.     }    
  390.     return sHTML;
  391. }
  392.  
  393.  
  394. function getInnerText(obj)
  395. {
  396.     var renbsp2sp=new RegExp("\xa0","g");
  397.     if(obj.innerText)
  398.     {
  399.         var sText=obj.innerText;
  400.         sText=sText.replace(renbsp2sp," ");
  401.         return sText;
  402.     }
  403.     else
  404.     {
  405.         if(obj.nodeValue)
  406.         {
  407.             var sValue=obj.nodeValue;
  408.             sValue=sValue.replace(renbsp2sp," ");
  409.             return sValue;
  410.         }
  411.         else
  412.         {
  413.             var sText="";
  414.             var oChild=obj.firstChild;
  415.             while(oChild!=null)
  416.             {
  417.                 sText+=getInnerText(oChild);
  418.                 oChild=oChild.nextSibling;
  419.             }
  420.             return sText;
  421.         }
  422.     }
  423.         
  424. }
  425.  
  426. function HighLightElement(obj,sHighLightColor,sNormalColor)
  427. {
  428.     if(obj!=null)
  429.     {
  430.         resetHighLight(sNormalColor);
  431.         if (obj.style)
  432.             obj.style.backgroundColor=sHighLightColor;
  433.         goHighLighted=obj;
  434.     }
  435. }
  436.  
  437. function resetHighLight(sNormalColor)
  438. {
  439.     if(goHighLighted!=null)
  440.     {
  441.         if (goHighLighted.style)
  442.             goHighLighted.style.backgroundColor=sNormalColor;
  443.         goHighLighted=null;
  444.     }
  445. }
  446.  
  447. function whFont(sName,sSize,sColor,sStyle,sWeight,sDecoration)
  448. {
  449.     this.sName=sName;
  450.     this.sSize=sSize;
  451.     this.sColor=sColor;
  452.     this.sStyle=sStyle;
  453.     this.sWeight=sWeight;
  454.     this.sDecoration=sDecoration;
  455. }
  456.  
  457. function getFontStyle(oFont)
  458. {
  459.     var sStyle="";
  460.     if(oFont)
  461.     {
  462.         sStyle+="font-family:"+oFont.sName+";";
  463.         if(gbMac)
  464.         {
  465.             var nSize=parseInt(oFont.sSize);
  466.             if(gbIE5)
  467.                 nSize+=2;
  468.             else
  469.                 nSize+=4;
  470.             sStyle+="font-size:"+nSize+"pt;";
  471.         }
  472.         else
  473.             sStyle+="font-size:"+oFont.sSize+";";
  474.             
  475.         sStyle+="font-style:"+oFont.sStyle+";";
  476.         sStyle+="font-weight:"+oFont.sWeight+";";
  477.         sStyle+="text-decoration:"+oFont.sDecoration+";";
  478.         sStyle+="color:"+oFont.sColor+";";
  479.     }
  480.     return sStyle;
  481. }
  482.  
  483. function _browserStringToText(sBStr)
  484. {
  485.     var sText="";
  486.     // change %xxx back to the real char.
  487.     var nPos=sBStr.indexOf('%');
  488.     while(nPos!=-1)
  489.     {
  490.         sText+=sBStr.substring(0,nPos);
  491.         sBStr=sBStr.substring(nPos+1);
  492.         var sNum="";
  493.         var i=0;
  494.         while(sBStr.charAt(i)>='0'&&sBStr.charAt(i)<='9')
  495.         {
  496.             sNum+=sBStr.charAt(i++);    
  497.         }
  498.         if(sNum!=""){
  499.             var nNum=parseInt(sNum,16);
  500.             sText+=String.fromCharCode(nNum);
  501.             sBStr=sBStr.substring(i);
  502.         }
  503.         nPos=sBStr.indexOf('%');
  504.     }
  505.     sText+=sBStr;
  506.     return sText;
  507. }
  508.  
  509. function excapeSingleQuotandSlash(str)
  510. {
  511.     if(str==null) return null;
  512.     var nPos=0;
  513.     var sRes="";
  514.     var nPosNew=str.indexOf("\\",nPos);
  515.     while(nPosNew!=-1){
  516.         sRes+=str.substring(nPos,nPosNew+1)+"\\";
  517.         nPos=nPosNew+1;
  518.         nPosNew=str.indexOf("\\",nPos);
  519.     }
  520.     if(nPos<str.length)
  521.         sRes+=str.substring(nPos);
  522.     var re=new RegExp("'","g");
  523.     sRes=sRes.replace(re,"\\'");
  524.     return sRes;
  525. }
  526.  
  527. var gbWhUtil=true;